import request from '@/utils/request.js'

/** 文章评论列表 */
export const getCommentList = params => {
  return request({
    method: 'GET',
    url: '/v1_0/comments',
    params
  })
}

/** 对评论点赞或回复点赞 */
export const addCommentLike = target => {
  return request({
    method: 'POST',
    url: '/v1_0/comment/likings',
    data: {
      target
    }
  })
}

/** 取消对评论点赞或回复点赞 */
export const cancelCommentLike = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/comment/likings/${target}`
  })
}

/** 添加评论 */
export const addComment = data => {
  return request({
    method: 'POST',
    url: '/v1_0/comments',
    data
  })
}
